package com.rubbo.server;

import com.rubbo.api.UserServicel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.remoting.rmi.RmiServiceExporter;

@Configuration
public class RMIConfig {

    @Autowired
    private UserServicel userServicel;

    @Bean
    public RmiServiceExporter rmiServiceExporter(){
        RmiServiceExporter rmiServiceExporter = new RmiServiceExporter();
        rmiServiceExporter.setService(userServicel);
        rmiServiceExporter.setServiceInterface(UserServicel.class);
        rmiServiceExporter.setRegistryPort(2002);
        rmiServiceExporter.setServiceName("userService");
        return rmiServiceExporter;
    }
}
